//
//  BRAnimationView.m
//  Kexu
//
//  Created by IOS on 2023/7/21.
//

#import "BRAnimationView.h"

@implementation BRAnimationView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setUI];
    }
    return self;
}

- (void)dealloc {
    [self stop];
    
    
}

#pragma mark - UI --
- (void)setUI {
    
}


-(void)start
{
    self.animationImages = self.idleImages;
    self.animationDuration = 0.9;//动画时间
    self.animationRepeatCount = 0;//动画重复次数，0：无限
    [self startAnimating];//开始动画
    
}

-(void)stop{
    [self stopAnimating];
    self.image = self.defaultImg;
}

-(NSMutableArray *)idleImages{
    if (!_idleImages) {
        _idleImages= [NSMutableArray array];
        for (int i = 1; i < 55; i++) {
            YYImage *image = [YYImage imageNamed:[NSString stringWithFormat:@"loading_%2d", i]];
            if (image) [_idleImages addObject:image];
            
        }
    }
    return _idleImages;
}


@end
